/**
 * 路由：2种，前端路由和后端路由
 */

const express = require('express')
const app = express()
const router = require('./router')

//  使用中间件，来配置router
router(app)

app.get('/book/:id/:zhang/:jie',(req,res)=>{
   console.log(req.query);
   console.log(req.params);
   // article.get(req.params.zhang,req.params.jie){
   //     res.send('第三章第六节')
   // }
   // let id = req.params.id
   // let zhang = req.params.zhang
   // let jie = req.params.jie

   // 解构es6 写法
   let {id,zhang,jie} = req.params
   res.send(`看的书是${id},${zhang},${jie}`)
  
})

app.get(/a/,(req,res)=>{
   res.send(req.url)
})






app.listen(3000,()=>{
    console.log(`服务已启动`);
})